from messAround.model.maoyan import MaoyanBoardModel, MaoyanTopicModel
import messAround.util.help as util


# 猫眼实时票房
class MaoyanBoardPipeline(object):

    @staticmethod
    def process_item(item, spider):
        return util.make_write_data({
            'name': item["name"],
            'release': item["release"],
            'money': item["money"],
            'count_rate': item["count_rate"],
            'seat_count_rate': item["seat_count_rate"],
            'show_count_rate': item["show_count_rate"],
        }, item, MaoyanBoardModel)


# 猫眼热门话题
class MaoyanTopicPipeline(object):

    @staticmethod
    def process_item(item, spider):
        return util.make_write_data({
            'title': item["title"],
            'link': item["link"],
        }, item, MaoyanTopicModel)
